function html2Escape(sHtml) {
    return sHtml.replace(/[<>&"]/g,function(c){return {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});
}
function removeHTMLTag(str) {
    str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag
    str = str.replace(/[ | ]*\n/g, '\n'); //去除行尾空白
    str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
    str = str.replace(/ /ig, ''); //去掉
    return str;
}

//滚动到顶部
scrollTop = function() {
    $('body,html').animate({
        scrollTop: 0
    }, 500);
    return false;
};
$(function () {
    $('#main-inner article pre').each(function (index,Element) {
        txt_arr = $(Element).text().replace(/\s+$/gm,'').split("\n");
        html = "";
        for(i=0;i<txt_arr.length;i++){
            html+="<div class='pre_lines'>"+html2Escape(txt_arr[i])+"</div>"
        }
        $(Element).html(html);
    });
    //滚动到顶部
    $('#scroll-top').on('click',function () {
        scrollTop();
    })
});